<?
function replaceMQ($text){
	$text	= str_replace("\'", "'", $text);
	$text	= str_replace("'", "''", $text);
	return $text;
}
$st = " Thanh Tuan \'";
echo replaceMQ($st);
?>